package com.minjiang.system.service.sec.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.minjiang.model.system.FoodDetail;
import com.minjiang.model.system.FoodType;
import com.minjiang.model.vo.FoodDetailQueryVo;
import com.minjiang.system.service.sec.FoodDetailService;
import com.minjiang.system.mapper.sec.FoodDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
* @author Administrator
* @description 针对表【food_detail】的数据库操作Service实现
* @createDate 2022-12-19 09:33:31
*/
@Service
public class FoodDetailServiceImpl extends ServiceImpl<FoodDetailMapper, FoodDetail>
    implements FoodDetailService{
    @Autowired
    private FoodDetailMapper foodDetailMapper;
    @Override
    public IPage<FoodDetail> selectPage(Page<FoodDetail> pageParam, FoodDetailQueryVo foodDetailQueryVo) {
        String title = foodDetailQueryVo.getKeyword();

        //封装参数
        QueryWrapper<FoodDetail> wrapper = new QueryWrapper<>();
        if(!StringUtils.isEmpty(title)) {
            wrapper.like("food_name",title);
        }
        //调用mapper方法实现分页条件查询
        IPage<FoodDetail> foodDetailIPage = foodDetailMapper.selectPage(pageParam, wrapper);
        return foodDetailIPage;
    }
}




